﻿using Styx.WoWInternals;
using Styx.WoWInternals.WoWObjects;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KittyDru.Helpers
{
    internal static class Helpers
    {
        private static LocalPlayer Me { get { return Styx.StyxWoW.Me; } }

        public static bool HasMyAura(this WoWUnit target, string spell)
        {
            if (!target.IsValid || !target.IsUnit || !target.IsAlive) return false;
            //if (!Unit.ValidUnit(target)) return false;

            if (target.GetAllAuras().Where(a => a.Name == spell && a.CreatorGuid == Me.Guid).Any())  return true;
            return false;
        }



        public static Dictionary<string, WoWAura> MyAuras(this WoWUnit unit)
        {
            if (!Unit.ValidUnit(unit)) return null;
            return unit.Auras.Where(a => a.Value.CreatorGuid == Me.Guid).ToDictionary(a => a.Key, b => b.Value);
        }


    }
}
